/*  File Name	: MonitorSock.h
 *  Author		: Pang Jiacai
 *	 E-mail		: 823960168@qq.com
 *  Created on	: 2012-7-2
 *  Description:
 */

#ifndef MONITORSOCK_H_
#define MONITORSOCK_H_
#include "Acceptor.h"
#include "Connector.h"
#include "SockAcceptor.h"
#include "SockConnector.h"
#include "Monitor.h"

template<class MONITOR,class SERVICE>
class MonitorAcceptor:public Acceptor<SERVICE,SockAcceptor>
{
public:
	MonitorAcceptor(MONITOR *monitor=NULL);

	virtual ~MonitorAcceptor();

	void monitor(MONITOR* monitor);

protected:
	virtual int make_svc_handler(SERVICE *&svc);

private:
	MONITOR *monitor_;
};

template<class MONITOR,class SERVICE>
class MonitorConnector:public Connector<SERVICE,SockConnector>
{
public:
	MonitorConnector(MONITOR *monitor=NULL);

	virtual ~MonitorConnector();

	void monitor(MONITOR* monitor);

protected:
	virtual int make_svc_handler(SERVICE *&svc);

private:
	MONITOR *monitor_;
};

#include "MonitorSock.cpp"

#endif /* MONITORSOCK_H_ */
